<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="name here">
    <meta name="author" content="name here">	
	
	 <title>Title here</title>
	 
	<link rel="stylesheet" href="css/jquery.mobile.structure-1.3.0.css">
	<link rel="stylesheet" href="themes/BancoDelPeru.css">
	
	<script src="js/jquery-1.9.1.js"></script>
	<script src="js/jquery.mobile-1.3.0.js"></script>
	<script type="text/javascript" src="js/cordova-2.5.0.js" charset="utf-8" ></script>
	<script src="js/configs.js"></script>
	
	
	<script type="text/javascript" charset="utf-8">
		function iniciar() {			
			document.addEventListener("deviceready", dispositivoListo, false);			
		}
		function dispositivoListo() {
						
		}
		
		//var count = 2;
	    function sendCustomer(){
	    	var cust = $("#customerID").val();
		    var pass = $("#customerPassword").val();
		    

		    console.log("inside");
		    
		    $.post("http://"+SERVER_IP_ADDRESS+":8080/WebBancoPeru/rest/customer/login", {customerID: cust, customerPassword: pass}, function(data){	    		
	    				  
		    	 console.log("inside"+data.status);
		        if ( "valid" == data.status ) {
		        	alert("Done!");
		        	window.localStorage.setItem("customerID", data.CustomerID);
		        	window.location.assign("securityquestion.html");
		        	//window.location.assign("mainmenu.html");
		        	
		        	
		        } else {
		        	alert("Incorrect Password or UserID");
		        } 
		        	
	    	}, "json");
	    }
		
	</script>
</head>
<body onload="iniciar()">

	<div data-role="page">
		<div data-role="header" data-position="fixed">		
			<h1>Banco Per&uacute;</h1>
		</div>
		
		<div data-role="content">
			<label for="input_user">Username:</label>
			<input type="text" name="username" id="customerID" placeholder='type your userID' 
			class="required"/>
			
			<label for="text-basic">Password:</label>
			<input type="password" name="password" id="customerPassword" class="required"
			placeholder='type your password'/> 
			
			<!--  -->				
	 
	 		
<a type="button" data-inline="true" data-align="true" rel="external" onclick="sendCustomer()"> Login</a> 
<a data-role="button" href="changepassword.html" data-inline="true" rel= "external"> Change Password</a>
		</div>
		
	 <script type="text/javascript" charset="utf-8">		
	 </script>
		
		
		<div data-role="footer" data-position="fixed">
			<h1>Banco Per&uacute; &copy; 2013</h1>
		</div>
	</div>

</body>

</html>